set srcsolndir=X:\svn\Emlyn.Applications\Emlyn.Applications.LochAlarm Solution
set solndir=X:\svnbin\Emlyn.Applications\Emlyn.Applications.LochAlarm Solution
set vernamefolder=X:\svnbin\Emlyn.Applications.Console.VersionNumberAdder Solution\Emlyn.Applications.Console.VersionNumberAdder\bin\Release
set prodname=LochAlarm

mkdir "%solndir%\DeployTemp"

del /Q "%solndir%\DeployTemp\*.*"

copy "%solndir%\Emlyn.Applications.%prodname%.Installer\Release\Emlyn.Applications.%prodname%.Installer.msi" "%solndir%\DeployTemp\%prodname% v#vernum#.msi" 

"%vernamefolder%\vername.exe" "%solndir%\DeployTemp\%prodname% v#vernum#.msi" "%solndir%\Emlyn.Applications.%prodname%\bin\Release\Emlyn.Applications.LochAlarm.exe"

rmdir /S /Q "%solndir%\DeployTemp\source"
mkdir "%solndir%\DeployTemp\source"

xcopy "%srcsolndir%\Emlyn.Applications.%prodname%" "%solndir%\DeployTemp\source\Emlyn.Applications.%prodname%" /S /E /I

rmdir /S /Q "%solndir%\DeployTemp\source\Emlyn.Applications.%prodname%\obj"

xcopy "%srcsolndir%\Emlyn.Applications.%prodname%.Installer" "%solndir%\DeployTemp\source\Emlyn.Applications.%prodname%.Installer" /S /E /I

xcopy "%srcsolndir%\Emlyn.Applications.%prodname% Solution.sln" "%solndir%\DeployTemp\source"

"C:\Program Files\7-Zip\7z.exe" a -r -tzip "%solndir%\DeployTemp\%prodname% v#vernum#.zip" "%solndir%\DeployTemp\*"

"%vernamefolder%\vername.exe" "%solndir%\DeployTemp\%prodname% v#vernum#.zip" "%solndir%\Emlyn.Applications.%prodname%\bin\Release\Emlyn.Applications.LochAlarm.exe"

ftp -s:ftpdeploy.txt -i
